package quantri.login;

import java.util.ArrayList;
import java.util.Iterator;

/******************************************
 * Filename			: Category.java
 * Decription		:
 * Created date		: Jun 2, 2008
 * Author			: Phonglt
 ******************************************/
public class Category {
	private int id;
	private String fullname;
	private ArrayList<Function> functions = new ArrayList<Function>();

	
	/**
	 * @param id
	 * @param fullname
	 */
	public Category(int id, String fullname) {
		this.id = id;
		this.fullname = fullname;
	}

	/****************************************************
	 * Method name		: getFunctions [GETTER]
	 * Return type		: ArrayList<String>
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public ArrayList<Function> getFunctions() {
		return functions;
	}

	/****************************************************
	 * Method name		: setFunctions [SETTER]
	 * Return type		: void
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public void setFunctions(ArrayList<Function> functions) {
		this.functions = functions;
	}

	/****************************************************
	 * Method name		: getId [GETTER]
	 * Return type		: Category
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public int getId() {
		return id;
	}

	/****************************************************
	 * Method name		: setId [SETTER]
	 * Return type		: void
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public void setId(int id) {
		this.id = id;
	}

	/****************************************************
	 * Method name		: getFullname [GETTER]
	 * Return type		: Category
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public String getFullname() {
		if ("".equals(this.fullname)) {
			return "Empty";
		} 
		return fullname;
	}

	/****************************************************
	 * Method name		: setFullname [SETTER]
	 * Return type		: void
	 * Decription		: 
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 ****************************************************/
	public void setFullname(String fullname) {
		this.fullname = fullname;
	}
	
	/**************************************
	 * Method name		: addFunction
	 * Return type		: void
	 * Decription		: Thêm chức năng vào cat
	 * Created date		: Jun 2, 2008
	 * Author			: Phonglt
	 **************************************/
	public boolean addFunction(Function function){
		return this.functions.add(function);
	}
	
	public Iterator<Function> getIterator(){
		return this.functions.iterator();
	}
}
